import React,{Component} from 'react'

class Child extends Component{
	render(){
		console.log('child render')
		return (
			<div className="wrapper">
				<h4 className='display-4'>这里是标题</h4>
			</div>
		)
	}
}

class DemoA extends Component{
	state={name:'cowen'}
	changeState=()=>{
		this.setState({})
	}
	shouldComponentUpdate(nextProps,nextState){
		// 组件不会再render
		if(nextState.name===this.state.name){
			return false
		}
		return true;
	}
	render(){
		console.log('parent render')
		return (
			<div className="wrapper" style={{backgroundColor:'green'}}>
				<Child />
				<button onClick={this.changeState} className='btn btn-primary'>更改State</button>
			</div>
		)
	}
}

export default DemoA